import Vue from 'vue'
import VueRouter from 'vue-router'
import HomeView from '../views/HomeView.vue'
// import HomeRecommend from '../views/HomeRecommend.vue'
// import HomeFeed from '../views/HomeFeed.vue'
// import HomeHot from '../views/HomeHot.vue'
import NotesView from '../views/NotesView.vue'
import SearchView from '../views/SearchView.vue'
import SearchRecommendView from '../views/SearchRecommendView.vue'
import SearchCategorieView from '../views/SearchCategorieView.vue'
import SearchingView from '../views/SearchingView.vue'
import SearchedView from '../views/SearchedView.vue'
import ClassroomView from '../views/ClassroomView.vue'
import MineView from '../views/MineView.vue'
import UserView from '../views/UserView.vue'
import UserArticles from '../views/UserArticles.vue'
import UserFavorites from '../views/UserFavorites.vue'
import UserCollections from '../views/UserCollections.vue'
import UserLike from '../views/UserLike.vue'
import UserDetail from '../views/UserDetail.vue'
import UserFollow from '../views/UserFollow.vue'
import UserFan from '../views/UserFan.vue'
import MineFollow from '../views/MineFollow.vue'
import ArticleView from '../views/ArticleView.vue'
import HotCategorie from '../views/HotCategorie.vue'
import GlobalSelection from '../views/GlobalSelection.vue'
import HotMovier from '../views/HotMovier.vue'
import LoginView from '../views/LoginView.vue'
import BrowseHistory from '../views/BrowseHistory.vue'
import FavoriteDetail from '../views/FavoriteDetail.vue'
import NoteDetail from '../views/NoteDetail.vue'

Vue.use(VueRouter)

const routes = [
  {
    path: '/',
    name: 'home',
    component: HomeView,
    meta: { showFooter: true },
    // children: [
    //   { path: "recommend", name: "recommend", component: HomeRecommend, meta: { showFooter: true }, },
    //   { path: "feed", name: "feed", component: HomeFeed, meta: { showFooter: true }, },
    //   { path: "hot", name: "hot", component: HomeHot, meta: { showFooter: true }, },
    // ],
    // redirect: "/recommend",
  },
  {
    path: '/notes',
    name: 'notes',
    component: NotesView,
    meta: { showFooter: true }
  },
  {
    path: '/search',
    name: 'search',
    component: SearchView,
    meta: { showFooter: true }
  },
  {
    path: '/searchRecommend',
    name: 'searchRecommend',
    component: SearchRecommendView,
    meta: { showFooter: false }
  },
  {
    path: '/searchCategorie',
    name: 'searchCategorie',
    component: SearchCategorieView,
    meta: { showFooter: false }
  },
  {
    path: '/searching',
    name: 'searching',
    component: SearchingView,
    meta: { showFooter: false }
  },
  {
    path: '/searched',
    name: 'searched',
    component: SearchedView,
    meta: { showFooter: false }
  },
  {
    path: '/classroom',
    name: 'classroom',
    component: ClassroomView,
    meta: { showFooter: true }
  },
  {
    path: '/mine',
    name: 'mine',
    component: MineView,
    meta: { showFooter: true }
  },
  {
    path: '/user',
    name: 'user',
    component: UserView,
    meta: { showFooter: false },
    children: [
      { path: 'userArticles', name: 'userArticles', component: UserArticles, meta: { showFooter: false }, },
      { path: 'userFavorites', name: 'userFavorites', component: UserFavorites, meta: { showFooter: false }, },
      { path: 'userCollections', name: 'userCollections', component: UserCollections, meta: { showFooter: false }, },
      { path: 'userLike', name: 'userLike', component: UserLike, meta: { showFooter: false }, },
      { path: 'userDetail', name: 'userDetail', component: UserDetail, meta: { showFooter: false }, },
    ],
    redirect: '/user/userArticles'
  },
  {
    path: '/userFollow',
    name: 'userFollow',
    component: UserFollow,
    meta: { showFooter: false }
  },
  {
    path: '/userFan',
    name: 'userFan',
    component: UserFan,
    meta: { showFooter: false }
  },
  {
    path: '/mineFollow',
    name: 'mineFollow',
    component: MineFollow,
    meta: { showFooter: false }
  },
  {
    path: '/article',
    name: 'article',
    component: ArticleView,
    meta: { showFooter: false }
  },
  {
    path: '/hotCategorie',
    name: 'hotCategorie',
    component: HotCategorie,
    meta: { showFooter: false }
  },
  {
    path: '/globalSelection',
    name: 'globalSelection',
    component: GlobalSelection,
    meta: { showFooter: false }
  },
  {
    path: '/hotMovier',
    name: 'hotMovier',
    component: HotMovier,
    meta: { showFooter: false }
  },
  {
    path: '/login',
    name: 'login',
    component: LoginView,
    meta: { showFooter: false }
  },
  {
    path: '/browseHistory',
    name: 'browseHistory',
    component: BrowseHistory,
    meta: { showFooter: false }
  },
  {
    path: '/favoriteDetail',
    name: 'favoriteDetail',
    component: FavoriteDetail,
    meta: { showFooter: false }
  },
  {
    path: '/noteDetail',
    name: 'noteDetail',
    component: NoteDetail,
    meta: { showFooter: false }
  },
]

const router = new VueRouter({
  routes
})

const originalPush = VueRouter.prototype.push
VueRouter.prototype.push = function push(location) {
  return originalPush.call(this, location).catch(err => err)
}


export default router
